<style>
.jylabel-switch {padding:0.3rem 0.5rem;}
.jylabel-switch.active{
	border-radius:1.5rem;
	background-color:#00c568;
	color:#fff;
}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
.fui-footer.quick {
    background: {{main.syscolor||'#db232b'}};
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    z-index: 30;
}
.fui-footer.quick .quick-cart {
    width: 3.6rem;
    position: relative;
}
.fui-footer.quick .quick-cart.an {
    animation: cartan 0.5s;
}
@keyframes cartan {
    0% {
        transform: scale(0.8);
        -ms-transform: scale(0.8);
        -webkit-transform:scale(0.8);
        -o-transform: scale(0.8);
        -moz-transform: scale(0.8);
    }
    25% {
        transform:scale(1.1);
        -ms-transform: scale(1.1);
        -webkit-transform:scale(1.1);
        -o-transform: scale(1.1);
        -moz-transform: scale(1.1);
    }
    50% {
        transform:scale(0.9);
        -ms-transform: scale(0.9);
        -webkit-transform:scale(0.9);
        -o-transform: scale(0.9);
        -moz-transform: scale(0.9);
    }
    100% {
        transform:scale(1);
        -ms-transform: scale(1);
        -webkit-transform:scale(1);
        -o-transform: scale(1);
        -moz-transform: scale(1);
    }
}
.fui-footer.quick .quick-cart .dot {
    background: #f60;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.6rem;
    height: 0.8rem;
    line-height: 0.8rem;
    margin-left: 0.1rem;
    min-width: 0.8rem;
    padding: 0 0.2rem;
    position: absolute;
    top: 0.2rem;
    right: 0;
    vertical-align: top;
    text-align: center;
    z-index: 11;
    display: none;
}
.fui-footer.quick .quick-cart .inner {
    height: 3rem;
    width: 3rem;
    border-radius: 3rem;
    background: {{main.syscolor||'#db232b'}};
    border: 0.25rem solid #4d4d4d;
    color: #fff;
    text-align: center;
    line-height: 2.6rem;
    position: absolute;
    right: 0;
    bottom: 0.26rem;
    z-index: 10;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.3);
    -moz-box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.fui-footer.quick .quick-cart .inner .icon {
    font-size: 1.4rem;
}
.fui-footer.quick .quick-cart.empty .inner {
    background: #404040;
    color: #67676b;
}
.fui-footer.quick .quick-info {
    width: 100%;
    padding: 0.3rem 0.4rem;
    line-height: 2.5rem;
    font-size: 0.65rem;
    color: #fff;
	border-right:2px solid #fff;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
}
.fui-footer.quick .quick-info .price {
    font-size: 1.3rem;
    line-height: 1.6rem;
}
.fui-footer.quick .quick-submit {
    height: 2.5rem;
    padding: 0 1.2rem;
    line-height: 2.5rem;
    color: #fff;
    display: inline-block;
}
.fui-footer.quick .quick-submit.disabled {
    background: #fff;
}
/* 数量选择器 */
.quick-num {
    height: 1.1rem;
    width: auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}
.quick-num.open .minus {
    -moz-transition-duration: 300ms;
    -webkit-transition-duration: 300ms;
    transition-duration: 300ms;
    -webkit-transform: translate3d(0, 0, 0) rotate(0deg);
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
}
.quick-num.open .num {
    -moz-transition-duration: 300ms;
    -webkit-transition-duration: 300ms;
    transition-duration: 300ms;
    opacity: 1;
}
.quick-num.close .minus {
    animation: closeminus 0.2s;
    animation-fill-mode : forwards;
}
.quick-num.close .num {
    -moz-transition-duration: 100ms;
    -webkit-transition-duration: 100ms;
    transition-duration: 100ms;
    opacity: 0;
}
@keyframes closeminus {
    20% {
        -webkit-transform: translate3d(50%, 0, 0) rotate(0deg);
        transform: translate3d(50%, 0, 0) rotate(0deg);
        opacity: 1;
    }
    50% {
        -webkit-transform: translate3d(100%, 0, 0) rotate(30deg);
        transform: translate3d(100%, 0, 0) rotate(30deg);
        opacity: 0.5;
    }
    70% {
        -webkit-transform: translate3d(150%, 0, 0) rotate(60deg);
        transform: translate3d(150%, 0, 0) rotate(60deg);
        opacity: 0.3;
    }
    80% {
        -webkit-transform: translate3d(200%, 0, 0) rotate(90deg);
        transform: translate3d(200%, 0, 0) rotate(90deg);
        opacity: 0.2;
    }
    100% {
        opacity: 0;
    }
}
.quick-num .minus,
.quick-num .plus {
    height: 1.2rem;
    width: 1.2rem;
    line-height: 1.2rem;
    font-size: 1.2rem;
    text-align: center;
    border-radius: 2rem;
}
.quick-num .minus {
    color: {{main.syscolor||'#db232b'}};
    border: 1px solid {{main.syscolor||'#db232b'}};
    -webkit-transform: translate3d(200%, 0, 0) rotate(90deg);
    transform: translate3d(200%, 0, 0) rotate(90deg);
    -webkit-transition-property: -webkit-transform;
    transition-property: transform;
    background: #fff;
    opacity: 0;
    position: relative;
    z-index: 8;
}
.quick-num .minus.disabled {
    color: #dadada;
    border-color: #dadada;
}
.quick-num .plus {
    background: {{main.syscolor||'#db232b'}};
    color: #fff;
    position: relative;
    z-index: 11;
}
.quick-num .plus.disabled {
    background: #dadada;
}
.quick-num .num {
    height: 1.2rem;
    line-height: 1.2rem;
    font-size: 0.85rem;
    min-width: 1.2rem;
    padding: 0 0.2rem;
    text-align: center;
    color: #fff;
    opacity: 0;
}
</style>
<div class='fui-page fui-page-current'>
<div class="fui-header">
		<div class="fui-header-left" onclick="window.history.go(-1);">
            <a class="back"></a>
        </div>
		<div class="title">报单</div>
		<div class="fui-header-right"></div>
</div>
<div class='fui-content'>
<div style="padding:0.5rem">
<div class='fui-cell-title c bold' style="padding-bottom:0">报单商户【{{pagedata.merch.merchname}}】
<a ng-click="pagedata.baoshow=true" style="border-radius: 1rem;padding:0.2rem 0.3rem;font-size:0.6rem; background-color:{{main.syscolor||'#05c175'}};;width:auto;color:#fff"><i class="icon icon-qiehuan" style="font-size:0.6rem"></i> 切换商户</a>
</div>
<div class='fui-cell-title c gray' style="font-size:0.6rem;padding-top:0">地址：【{{pagedata.merch.address}}】</div>
<div class="weui_cells weui_cells_form" style="margin-top:0">
	<div ng-if="pagedata.sendtypes" id="carrierTab" class="fui-tab fui-tab-danger" style="margin-bottom: 0">
            <a ng-repeat="(k,v) in pagedata.sendtypes" ng-class="{'active':pagedata.post.sendtype==k}" ng-click="pagedata.post.sendtype=k">{{v}}</a>
        </div>
			  <div class="weui_cell weui_vcode">
                <div class="weui_cell_hd"><label class="weui_label">姓名</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="pagedata.post.realname" placeholder="请输入客户的真实姓名">
                </div>
            </div>
            <div class="weui_cell weui_vcode">
                <div class="weui_cell_hd"><label class="weui_label">手机</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="pagedata.post.mobile" placeholder="请输入客户的手机号码">
                </div>
            </div>
			<div class="weui_cell weui_vcode">
                <div class="weui_cell_hd"><label class="weui_label">客户会员ID</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="pagedata.post.mid" placeholder="请输入客户的客户会员ID">
                </div>
            </div>
			<div class="weui_cell">
				<div class="weui_cell_hd">客户地址</div>		
							<div class="weui_cell_hd" style="width:28%">
								<select ng-model="pagedata.post.pcd.province" class="form-control tpl-province">
								<option value="" selected="selected">省份</option>
								<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.post.pcd.province==value">{{value}}</option>
								</select>
							</div>
							<div class="weui_cell_hd" style="width:28%">
								<select ng-model="pagedata.post.pcd.city" class="form-control tpl-city">
								<option value="" selected="selected">城市</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.post.pcd.province]" value="{{value}}" ng-selected="pagedata.post.pcd.city==value">{{value}}</option>
								</select>
							</div>
							<div class="weui_cell_hd" style="width:28%">
								<select ng-model="pagedata.post.pcd.district" class="form-control tpl-district">
								<option value="" selected="selected">区县</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.post.pcd.province][pagedata.post.pcd.city]" value="{{value}}" ng-selected="pagedata.post.pcd.district==value">{{value}}</option>
								</select>
							</div>
							<div class="weui_cell_hd" style="width:28%">
								<select ng-model="pagedata.post.pcd.street" class="form-control tpl-district">
								<option value="" selected="selected">街道</option>
								<option ng-repeat="value in pagedata.province[pagedata.post.pcd.province][pagedata.post.pcd.city][pagedata.post.pcd.district]" value="{{value}}" ng-selected="pagedata.post.pcd.street==value">{{value}}</option>
								</select>
							</div>
				
			</div>
			<div class="weui_cell">
                <div class="weui_cell_hd"><label for="" class="weui_label">详细地址</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" ng-model="pagedata.post.address" type="text" placeholder="">
                </div>
			</div>
			<div class="weui_cells_title" style="margin-bottom:0.5rem">代购商品
			<span ng-click="pagedata.showgoods=true" class="r-f" style="font-size:0.65rem">去商品库选择 <i class="icon icon-more" style="font-size:0.6rem;color:#999"></i></span>
			</div>
			<div class="fui-list-group item-ng" style="border: 1px dashed #00a0e9;" ng-repeat="(key,g) in pagedata.post.goods track by $index">
			<div class='fui-list align-start' style="padding-top:0.5rem;">
							<div class='fui-list-media'>
							   <img style="width: 5rem;height: 5rem;" ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" />
							</div>
							<div class='fui-list-inner'>
								<div class='text bold'>{{g.title}}</div>
								<div ng-if="g.selespename" style="font-size:0.6rem;color:#666">规格：{{g.selespename}}</div>
								<div class="fui-cellone" style="padding:0.5rem 0;">
									<div class='fui-cellone-label' style="width:auto">
									   <div class="bigprice red bold" style="font-size:1rem;position:relative">
										￥{{g.price}}
										</div>
										
									</div>
									<div class='fui-cellone-info' style="padding-left:0.2rem">
										<span class="arrow-left"></span><span style="display:inline-block;padding:0.1rem 0.3rem;color:#fff;font-size:0.5rem;background:#ff4e2c;border-radius:0.1rem;">单价</span>
									</div>
									<div class='fui-cellone-remark noremark'>
										<span style="font-size:0.6rem;color:#666">已选择{{g.total}}{{g.unit||'件'}}</span>
									</div>
								</div>
							</div>
			</div>
			<div class='fui-list c' style="background:#f2f2f2;padding:0.2rem 0.3rem">
				<div class='fui-list-inner' ng-click="pagedata.delgoods(key)">
					<i class="icon icon-shanchu1" style="font-size:0.6rem;color:#999"> 删除</i>
				</div>
			</div>
		</div>
			<div class="weui_cell weui_vcode">
                <div class="weui_cell_hd"><label class="weui_label">备注</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="pagedata.post.remark" placeholder="请输入备注">
                </div>
            </div>
		<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">商品价格</label></div>
                <div class="weui_cell_bd weui_cell_primary red">
                    ￥{{pagedata.post.goodsprice || '0.00'}}
                </div>
         </div>
		 <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">配送费用</label></div>
                <div class="weui_cell_bd weui_cell_primary red">
                    ￥{{pagedata.post.dispatchprice|| '0.00'}}
                </div>
         </div>
		 <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">订单总价</label></div>
                <div class="weui_cell_bd weui_cell_primary red">
                    ￥{{pagedata.post.price|| '0.00'}}
                </div>
         </div>
		 <div class="weui_cell">
			<div class="weui_cell_hd" style="">
				付款方式
			</div>
			<div class="weui_cell_bd"></div>
			 <div class="weui_cell_ft weui_cells_checkbox" style="padding:0">
			<label class="weui_cell weui_check_label" for="s11" style="padding: 0">
                <div class="weui_cell_bd weui_cell_primary">
                    <span>配送员代付款</span>
                </div>
				 <div class="weui_cell_hd" ng-click="pagedata.post.paytype=1">
                    <input type="checkbox" class="weui_check" name="paytype" value="1" ng-checked="pagedata.post.paytype==1">
                    <i class="weui_icon_checked"></i>
                </div>
            </label>
			<label class="weui_cell weui_check_label" for="s11" style="padding: 0">
                <div class="weui_cell_bd weui_cell_primary">
                    <span>录单后客户线上付款</span>
                </div>
				 <div class="weui_cell_hd" ng-click="pagedata.post.paytype=2">
                    <input type="checkbox" class="weui_check" name="paytype" value="2" ng-checked="pagedata.post.paytype==2">
                    <i class="weui_icon_checked"></i>
                </div>
            </label>
			 </div>
		</div>
		<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">设置预约配送</label></div>
                <div class="weui_cell_bd weui_cell_primary r">
                    <div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="pagedata.showtimeset=true">点击设置</div>
                </div>
         </div>
		 <div class="fui-cellone" style="margin-top:-0.5rem;margin-bottom:0.5rem;padding:0.2rem;background:#f2f2f2">
				<div class="fui-cellone-info gray">
						{{pagedata.post.peiset.days}}
				</div>
		</div>
</div>
<div class="weui_btn_area">
	 <a class="weui_btn weui_btn_primary" href="javascript:" ng-click="post(pagedata.post,'jy_peimilk/baodan/post/')">提交</a>
</div>
</div>
</div>
<div ng-if="pagedata.showgoods" class="popup">
<div class="popup-body">
<div class="popup-bottom">
<i class="closed icon icon-cuowu" ng-click="pagedata.showgoods=false"></i>
	<div class="fui-content" style="padding-bottom:2.5rem">
	<div class="fui-fullHigh-group">
        <div class="fui-fullHigh-item menu" id="tab">
            <nav ng-class="{'on':pagedata.params.pid =='-1'}" ng-click="pagedata.params.order='';pagedata.params.pid ='-1';tool.get_list('jy_weishop/goods.index/getlist/is_specs=1',true)">全部商品</nav>
			<nav ng-class="{'on':pagedata.params.order =='isrecommand'}" ng-click="pagedata.params.pid ='';pagedata.params.order='isrecommand';tool.get_list('jy_weishop/goods.index/getlist/is_specs=1',true)">推荐宝贝</nav>
			<div ng-repeat="c1 in pagedata.category">
				<nav ng-class="{'on':pagedata.params.pid ==c1.id}" ng-click="pagedata.params.order='';pagedata.params.pid =c1.id;tool.get_list('jy_weishop/goods.index/getlist/is_specs=1',true)">{{c1.title}}</nav>
			</div>
        </div>
        <div class="fui-fullHigh-item modal-swiper-y">
				<p ng-if="pagedata.list.length<1" class="text-center text-cancel empty" style="margin-top:2rem;color:#999">暂时没有任何商品</p>
				<div class="fui-list-group goods-list-group" style="margin:0;margin-top:1rem;background:none">
					<div ng-repeat="g in pagedata.list" class="fui-list goods-item" aria-hidden="true" data-dismiss="modal" ng-click="pagedata.selectgoods(g);">
							<div class="fui-list-media">
								<img ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" class='round'/>
							</div>
							<div class='fui-list-inner'>
								<div class='subtitle'>{{g.title}}</div>
								<div class='text'><span class='text-danger'>￥{{g.price}}</span></div>
							</div>
							<div ng-if="(!g.specs_list || g.specs_list.length < 1) && g.total>0" class="fui-number small" style="right:0">
									<div ng-if="pagedata.post.goods[g.id+'_0'].total>0" class="minus" ng-click="pagedata.minus(g)"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
									<input ng-if="pagedata.post.goods[g.id+'_0'].total>0" class="num shownum" type="text" ng-model="pagedata.post.goods[g.id+'_0'].total" style="width:1rem" ng-change="pagedata.refresh()"/>
									<div class="plus" ng-click="pagedata.plus(g)"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
							</div>
							<div ng-show="(!g.specs_list || g.specs_list.length < 1) && g.total==0" class="btn btn-sm btn-danger-o disabled" style="line-height:1rem;">已售馨</div>
							<div ng-show="g.specs_list.length > 0" class="btn btn-sm btn-danger-o order-finish" style="line-height:1rem" onclick="$('#selecttaocan').modal();" ng-click="pagedata.g=g;pagedata.nowgkey=$index;" >选规格</div>
					</div>
				</div>
				<div ng-if="loading" class='infinite-loading'><span class='fui-preloader'></span><span class='text'> 正在加载...</span></div>
	   
        </div> 
    </div>
	<div class="fui-navbar">
		<a ng-click="pagedata.showgoods=false" class="nav-item btn btn-success confirmbtn">选择完毕</a>
	</div>
	</div>
</div>
</div>
</div>
</div>
<div ng-include="sys_html('_picker')"></div>
<div ng-if="pagedata.baoshow" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.baoshow=false"></i>
			 <div class='fui-cell-group fui-cell-group-o' style="padding:0.5rem 0;max-height:20rem;overflow-y:scroll">
				<div class='fui-cell-title c'>【选择要报单的商户】</div>
				<div class="fui-cell" ng-repeat="item in pagedata.merchs" href="javascript:;" ng-click="pagedata.changemerch(item);">
						<div class="fui-cell-label" style="width:auto">
							<img style="width:2rem;height:2rem" ng-src="{{tomedia(item.logo) || '../core/resource/images/nopic.jpg'}}"/>
						</div>
						<div class="fui-cell-info">
							<div class="subtitle" >
								<span class='realname'>{{item.merchname}}</span>
							</div>
							<div class="gray" style="font-size:0.6rem">{{item.address}}</div>
						</div>
						<div class="fui-cell-remark">
							前往报单
						</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('common/_setpei')"></div>
<script>
scope.pagedata.changemerch=function(merch){
	scope.pagedata.merch=merch;
	scope.pagedata.post.merchid=merch.id;
	scope.pagedata.params.merchid=merch.id;
	scope.pagedata.post.sendtype=merch.sendtype;
	scope.pagedata.post.sendtypes=merch.sendtypes;
	scope.pagedata.baoshow=false;
	scope.get('jy_peimilk/baodan/getcategory/merchid='+merch.id,function(res){
		scope.pagedata.category=res.list;
		scope.$evalAsync();
	});
	scope.tool.get_list('jy_peimilk/get_data/getlist/is_specs=1',true);
}
scope.pagedata.carts={};
scope.tool.get_list('jy_peimilk/get_data/getlist/is_specs=1',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_peimilk/get_data/getlist/is_specs=1');
}
scope.pagedata.forgoods=function(id,optionid){
	var postgoods=scope.pagedata.post.goods;
	for(var i=0;i<postgoods.length;i++){
		if(id==postgoods[i].id){
			if(!optionid || optionid==postgoods[i].optionid){
				return i;
			}
		}
	}
	return 'no'
}
//刷新总数和总价
scope.pagedata.refresh=function(goodsinfo,type){
	scope.post_json('jy_peimilk/baodan/upgoods/type='+type,goodsinfo,function(res){
		scope.pagedata.post.goods=res.allgoods;
		scope.pagedata.post.goodsprice=res.goodsprice;
		scope.pagedata.post.price=res.goodsprice;
		scope.$evalAsync();
	});
}
//减少
scope.pagedata.minus=function(goodsinfo){
	scope.pagedata.refresh(goodsinfo,'minus');
}
//增加
scope.pagedata.plus=function(goodsinfo){
	scope.pagedata.refresh(goodsinfo,'plus');
}
//减少
scope.pagedata.sp_minus=function(){
	var goodsinfo =scope.pagedata.g;
	scope.pagedata.refresh(goodsinfo,'sp_minus');
}
//增加
scope.pagedata.sp_plus=function(){
	var goodsinfo =scope.pagedata.g;
	scope.pagedata.refresh(goodsinfo,'sp_plus');
}
//选择
scope.pagedata.get_optionsid=function(){
	var goodsinfo =scope.pagedata.g;
	var specid = goodsinfo.specid;
	specid = specid.join('_');
	scope.post_json('jy_weishop/goods.detail/get_optionsid/',{'goodsid':goodsinfo.id,'specid':specid},function(res){
			var optionsid=res.options.id;
			scope.pagedata.g.options=res.options;
			scope.pagedata.g.selespename=res.selespename;
			scope.$evalAsync();
	});
}
scope.pagedata.settaocan=function(options){
	console.log(options)
	scope.pagedata.g.options=options;
	scope.pagedata.g.selespename=options.title;
	scope.$evalAsync();
}
scope.pagedata.delgoods=function(key){
	var price=scope.pagedata.post.goods[key].price
	price=parseFloat(price);
	scope.pagedata.post.goodsprice -=price;
	scope.pagedata.post.price -=price;
	delete scope.pagedata.post.goods[key];
	scope.$evalAsync();
}
scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
</script>